package edu.szte.ovrt.datahandler.ui.console;

import java.util.NoSuchElementException;
import java.util.TreeMap;

public class MenuMap extends TreeMap<Integer, MenuItem> {

	public void add(final String title, final IAction action) {
		final MenuItem item = new MenuItem(title, action);
		int newKey = 0;
		try {
			newKey = lastKey() + 1;
		} catch (final NoSuchElementException e) {
			newKey = 1;
		}
		put(newKey, item);
	}

	public void addExit(final String title) {
		add(title, ExitAction.getInstance());

	}

}
